{% extends "agm1.0/base.html" %}
{% block base0 %}<style>
.head_pic, .ui-content{
    max-width: 1000px;
    margin: auto;
}
.head_pic img{
    width: 100%;
}
</style>{% endblock %}
{% block base1 %}{% endblock %}
{%- block body %}   
        <section id="track_check" data-role="page" data-add-back-btn="true">
            <header data-role="header" data-position="fixed">
                <a href="." data-icon="home" data-iconpos="notext" rel="external">Home</a>
                <h3>{{ _t('1:43轨道故障排除', '1:43 track troubleshooting')}}</h3>
            </header>
                <div class="head_pic"><img src="/static/images/tu2.jpg"></div>
                <div class='wx_logo' style='display:none;'><img src="/static/images/wx_logo.jpg"/></div> 
            <div data-role="content">
                <div id="display0">
                    <ul data-role="listview" data-inset="true" data-icon="arrow-r" class="ui-icon-alt"> 
                        {% if is_en %}
                        <li><a href="#a" data-ajax="false">The car can't run</a></li> 
                        <li><a href="#b" data-ajax="false">The car often runs off the track</a></li>
                        <li><a href="#c" data-ajax="false">The car is running slowly</a></li>                          
                        {% else %}
                        <li><a href="#a" data-ajax="false">小车不能跑动</a></li> 
                        <li><a href="#b" data-ajax="false">小车容易跑出轨道</a></li>
                        <li><a href="#c" data-ajax="false">小车行驶缓慢</a></li>  
                        {% endif %}
                    </ul>                
                </div>
                <div id="display1" style="display:none;">
                <h3 class="q_title"></h3>
                <img src="" class="q_image" style="max-width:100%;"/>
                <div class="quetion"></div>
                <div class="q_red" style="color:red"></div>
                <div id="choose" data-role="controlgroup" data-type="horizontal">
                    <a href="#a1" data-role="button" data-icon="check">{{_t('是','Yes')}}</a>
                    <a href="#a2" data-role="button" data-icon="delete">{{_t('否','No')}}</a>                    
                </div>
                <a href="#" id="backchoose" data-role="button" data-inline="true" data-icon="forward">{{_t('返回', 'Back')}}</a>
                </div>
            </div>
            <footer data-role="footer" data-position="fixed"><h5><small>©2020 {{_t('AGM 英宝玩具', 'Top-Racer')}}</small></h5></footer>
        </section>       
    {% endblock %}
{% block base2 %}<script>
{% if is_en %}
var q_a = {
    '#a': "Are the controllers fully inserted into the control box's No. 1 and 2 sockets?",
    '#a1': 'Does the controller controls the corresponding runway?',
    '#a2': 'Insert the controller fully into the socket of the control box',
    '#a11': 'Does the brush under the car touch the track correctly?',
    '#a12': 'Place the car on the corresponding track',
    '#a111': 'Is the car pointing in the correct direction?',
    '#a112': 'Arrange the brushes on the bottom of the car neatly and make sure that the brushes touch the track when placing the car',
    '#a1111': 'Can the car run on another track?',
    '#a1112': 'Place the car in the direction pointed by the arrow of <<<GO',
    '#a11111': 'The control box may be damaged',     
    '#a11112': 'The car may be damaged',   
    '#b': 'Is the brush not adjusted properly, causing the trolley to be supported and not completely stuck in the groove of the track?',
    '#b1': 'Adjust the brush to the correct position so that the bottom of the car can be completely stuck in the track groove',
    '#b2': 'Did the car rush out of the curve because it was too fast?',
    '#b21': 'It can slow down properly in corners to prevent excessive speed from causing inertia to rush out of the track',
    '#b22': 'Check that the tires are in the correct position',
    '#c': 'Is the track fastened tightly?',
    '#c1': 'Pick up the trolley and check whether the brush under the car is clean (no dust and debris can be adsorbed)',
    '#c2': 'Please fasten the track',
    '#c11': 'Are the brushes under the car worn or blackened, or are they rolled into a ball?',
    '#c12': 'Please clean the brush and wipe off the dust on the track surface',
    '#c112': 'Are the tires installed correctly?',
    '#c111': 'Replace with new brush',
    '#c1121': 'Are there more than 2 cars running on the same track',
    '#c1122': 'Please adjust the tires',
    '#c11211': 'Take one of the cars',
    '#c11212': 'If you change a car to run on the track, is it normal?',
    '#c112122': 'The controller or control box may be damaged',
    '#c112121': 'The car may be damaged, please replace it'    
}, q_t = {
    'a': "The car can't run",
    'b': 'The car often runs off the track',
    'c': "The car is running slowly",
}, q_image = {
    '#a1': 'http://cn.top-racer.com/images/trackcheck/en/图1.jpg',
    '#a11': 'http://cn.top-racer.com/images/trackcheck/en/图2.jpg',
    '#a111': 'http://cn.top-racer.com/images/trackcheck/en/图3.jpg',
    '#a112': 'http://cn.top-racer.com/images/trackcheck/en/图4.jpg',
    '#b': 'http://cn.top-racer.com/images/trackcheck/en/图5.jpg',
    '#b22': 'http://cn.top-racer.com/images/trackcheck/en/图6.jpg',
    '#b1': 'http://cn.top-racer.com/images/trackcheck/en/图2.jpg',
    '#c': 'http://cn.top-racer.com/images/trackcheck/en/图7.jpg',
    '#c1': 'http://cn.top-racer.com/images/trackcheck/en/图8.jpg',
    '#c11': 'http://cn.top-racer.com/images/trackcheck/en/图9.jpg',
    '#c112': 'http://cn.top-racer.com/images/trackcheck/en/图6.jpg',    
}, q_red = {
{#
    '#a112': '(*请参考刷片的调整一图)',
    '#b22': '(*请参考轮皮的调整一图)',
    '#c2': '(*请参考轨道板的拼装一图)',
    '#c111': '(*也可购买DTR-P3车底刷片配件包)',
    '#c1122': '（*请参考轮皮的调整一图）'
    #}
}
{% else %}
var q_a = {
    '#a': '检查电动/手摇控制器是否完全插入控制板1,2号插口处',
    '#a1': '控制器是否控制对应编号的跑道',
    '#a2': '把控制器完全插入控制板插孔处',
    '#a11': '车底刷片是否良好接触到轨道铁条',
    '#a12': '把小车放置在对应的赛道上',
    '#a111': '车头是否指向正确的行驶方向',
    '#a112': '把车底刷片拨整齐,放置车时,使刷片接触到轨道',
    '#a1111': '小车换到另一条跑道是否能跑',
    '#a1112': '把车头朝<<<GO的箭头所指方向摆放',
    '#a11111': '控制板可能损坏了',     
    '#a11112': '小车可能损坏了',   
    '#b': '是不是刷片没有调节好，使小车被支起，导致导向轨没有完全卡在轨道凹槽里',
    '#b1': '把刷片拨到正确的位置，使车底导向轨完全卡在轨道凹槽里',
    '#b2': '车子是否因为车速太快而冲出弯道',
    '#b21': '可在弯道适当减速,防止车速过快导致惯性冲出轨道',
    '#b22': '检查轮胎是否处于正确位置',
    '#c': '请检查轨道板之间是否扣紧',
    '#c1': '拿起小车检查车底刷片是否干净（无吸附灰尘杂物）',
    '#c2': '请把轨道板扣紧',
    '#c11': '车底的刷片是否磨损发黑，卷成一团',
    '#c12': '请清洁刷片，并用布擦去轨道表面积灰',
    '#c112': '请检查轮胎是否处于正确位置',
    '#c111': '在配件袋里找到备用刷片更换',
    '#c1121': '检查是否有2辆以上的车跑在同一轨道上',
    '#c1122': '请把轮胎拔到正确的位置',
    '#c11211': '拿走其中一辆车',
    '#c11212': '如果换一辆车放在轨道上跑，跑得是否正常',
    '#c112122': '控制器或者控制板可能损坏了',
    '#c112121': '小车可能损坏了，请更换'    
}, q_t = {
    'a': '小车不能跑动',
    'b': '小车容易跑出轨道',
    'c': '小车行驶缓慢',
}, q_image = {
    '#a1': 'http://cn.top-racer.com/images/trackcheck/图1.jpg',
    '#a11': 'http://cn.top-racer.com/images/trackcheck/图2.jpg',
    '#a111': 'http://cn.top-racer.com/images/trackcheck/图3.jpg',
    '#a112': 'http://cn.top-racer.com/images/trackcheck/图4.jpg',
    '#b': 'http://cn.top-racer.com/images/trackcheck/图5.jpg',
    '#b22': 'http://cn.top-racer.com/images/trackcheck/图6.jpg',
    '#b1': 'http://cn.top-racer.com/images/trackcheck/图2.jpg',
    '#c': 'http://cn.top-racer.com/images/trackcheck/图7.jpg',
    '#c1': 'http://cn.top-racer.com/images/trackcheck/图8.jpg',
    '#c11': 'http://cn.top-racer.com/images/trackcheck/图9.jpg',
    '#c112': 'http://cn.top-racer.com/images/trackcheck/图6.jpg',    
}, q_red = {
    '#a112': '(*请参考刷片的调整一图)',
    '#b22': '(*请参考轮皮的调整一图)',
    '#c2': '(*请参考轨道板的拼装一图)',
    '#c111': '(*也可购买DTR-P3车底刷片配件包)',
    '#c1122': '（*请参考轮皮的调整一图）'
}
{% endif %}
window.onhashchange = function(){
    var hash = location.hash;
    refresh(hash)
}
refresh_button = function(hash){
    if(q_a[hash+'1']){
    $('#choose').show();
    $('#choose [data-role=button]').each(function(){
        var self = $(this);
        switch(self.attr('data-icon')){
            case 'check':
                self.attr('href', hash+'1');
                break;
            case 'delete':
                self.attr('href', hash+'2');
                break;               
        }
    });
    }else{
        $('#choose').hide();
    }
    var backhash = hash.substr(0, hash.length-1);
    // if(backhash&&backhash!="#"){
        $('#backchoose').attr('href', backhash);        
    // }else{
    // }
}
refresh = function(hash){    
    if(!hash||hash=="#"){
        $('#display0').show();
        $('#display1').hide();
    }else{
        $('#display1').show();
        $('#display0').hide();        
        $('.quetion').text(q_a[hash]);
        if(q_image[hash]){
            $('img.q_image').attr('src', q_image[hash]).show();
        }else{
            $('img.q_image').hide();
        }
        if(q_red[hash]){
            $('.q_red').text(q_red[hash]).show();
        }else{
            $('.q_red').hide();
        }
        $('.q_title').text(q_t[hash.substr(1,1)]);
        refresh_button(hash);
    }    
}

$(document).ready(function(){
    if(location.hash){
        refresh(location.hash);
    }
})

$(document).on('click', '[data-role=button]', function(){
    var self = $(this);
    var hash = self.attr('href')
    console.info(self.attr('href'));
    location.hash = hash;
})

</script>{% endblock %}
